function main()

    global curGen
    global maxGen
    global NP
    global problem
    global dec_var_num
    global obj_num
    global max_vec
    global min_vec 
    problem='ZDT4'; 
    NP=100;  
    maxGen=500; 
    curGen=0;
    [dec_var_num,obj_num,max_vec,min_vec]=target_object();
    population=init_population();
    myplot(population);
    format short g;
    population=fast_non_domination_sort(population);
 
    for curGen=1:maxGen
        curGen
        pool=round(NP/2);
        tour=2;
        parent=tournament_selection(population,pool,tour);
        mu=20;
        mum=20;
        offspring=genetic_operator(parent,mu,mum);
        
        [~,main_pop]=size(population);
        [~,offspring_pop]=size(offspring);
       combined_population(:,1:main_pop)=population;
       combined_population(1:dec_var_num+obj_num,main_pop+1:main_pop+offspring_pop)=offspring;
       
       population=fast_non_domination_sort(combined_population);
       myplot(population);
       
    end
	solution=population

    
   % p=[0:0.1:2];
  % p=[-1/sqrt(3):0.05:1/sqrt(3);-1/sqrt(3):0.05:1/sqrt(3);-1/sqrt(3):0.05:1/sqrt(3)];
%   p=[0:0.1:2;0:0.1:2];
%     values=[];
%     [M,N]=size(p);
%     for i=1:N
%         values(:,i)=calculate_target_values(p(:,i)');
%     end
%     
%     hold on;
%     plot(values(1,:),values(2,:));


    
    
    

    

        



end
